This repository was archived by the owner on Jan 22, 2025. It is now read-only.
stake: Advance credits_observed on activation epoch#19309
Merged
joncinque merged 2 commits intosolana-labs:masterfrom Sep 3, 2021
Merged
stake: Advance credits_observed on activation epoch#19309joncinque merged 2 commits intosolana-labs:masterfrom
credits_observed on activation epoch#19309joncinque merged 2 commits intosolana-labs:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19309 +/- ##
=========================================
- Coverage 82.7% 82.5% -0.2%
=========================================
Files 461 468 +7
Lines 131215 131703 +488
=========================================
+ Hits 108519 108733 +214
- Misses 22696 22970 +274 |
t-nelson
previously approved these changes
Aug 21, 2021
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
194c6e7 to
e25efa5
Compare
Pull request has been modified.
mergify Bot
pushed a commit
that referenced
this pull request
Sep 3, 2021
* stake: Advance `credits_observed` on activation epoch * Add test for merging stakes just after activation (cherry picked from commit 2c3bded) # Conflicts: # runtime/src/bank.rs
mergify Bot
added a commit
that referenced
this pull request
Sep 4, 2021
… (#19626) * stake: Advance `credits_observed` on activation epoch (#19309) * stake: Advance `credits_observed` on activation epoch * Add test for merging stakes just after activation (cherry picked from commit 2c3bded) # Conflicts: # runtime/src/bank.rs * Fix merge issues Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
frits-metalogix
added a commit
to identity-com/solana
that referenced
this pull request
Nov 24, 2021
…-labs#19309)" This reverts commit 36d0d5f.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A stake does not receive rewards during its activation epoch, since
stake.delegation.stake(...always returns 0 for the activation epoch [1]. On the other hand itscredits_observedis not updated, which can make reward calculation confusing.[1]
solana/sdk/program/src/stake/state.rs
Lines 395 to 397 in b59b557
Summary of Changes
Advance
credits_observedduring the activation epoch. My approach was to reuse therewarded_epochbeing used elsewhere rather than going off thevote_state.epoch_credits()as used incalculate_stake_points_and_credits. It means there's some redundancy, but it felt clearer to me.Edit: this was built on #19308, and rebased since then to isolate the changes